var userChoice = prompt("piedra, papel o tijera?");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
	computerChoice = "piedra";
} else if(computerChoice <= 0.67) {
	computerChoice = "papel";
} else {
	computerChoice = "tijera";
}

var compare = function (choice1 , choice2){
    if (choice1 == choice2)
    {
        return "Empate!";
    }
    if (choice1 == "piedra")
    {
        if (choice2 == "tijera"){
            return "gana";
        }
        else
        {
            return "pierde";
        }
    }
    else if (choice1 == "papel")
    {
        if (choice2 == "piedra")
        {
            return "gana";
        }
        else
        {
            return "pierde";
        }
    }
    else if (choice1 == "tijera")
    {
        if (choice2 == "piedra")
        {
            return "pierde";
        }
        else
        {
            return "gana";
        }
    }
};

result= compare (userChoice, computerChoice);

